Given the HA stack is now in very good shape in Debian stretch [testing by now] we can start playing a bit with these tools.
There are 2 main points in doing so now:
- reporting bugs
- systemd integration
The last HA stack was in Debian wheezy, which didn't include systemd. Good to take that into account.
My hardware: 2 virtual machines with 1 NIC each. I called them node01 and node02.
Packages
Using aptitude. install debian packages corosync, pacemaker, pacemaker-cli-utils and crmsh.
The installation of the packages is enough for corosync to start working.
$
sudo
systemctl status corosync
corosync.service - Corosync Cluster Engine
Loaded: loaded (
/lib/systemd/system/corosync
.service; enabled; vendor preset: enabled)
Active: active (running) since mar 2016-02-09 11:01:24 CET; 3h 7min ago
Main PID: 14610 (corosync)
CGroup:
/system
.slice
/corosync
.service
14610
/usr/sbin/corosync
-f
$
sudo
crm status
Last updated: Tue Feb 9 14:11:33 2016 Last change: Tue Feb 9 11:01:48 2016 by hacluster via crmd on node01
Stack: corosync
Current DC: node01 (version 1.1.14-70404b0) - partition WITHOUT quorum
1 node and 0 resources configured
Online: [ node01 ]
Full list of resources:
Basic configurationYou will need to edit the /etc/corosync/corosync.conf file:
totem
version: 2
cluster_name: lbcluster
transport: udpu
interface
ringnumber: 0
bindnetaddr: 10.0.0.0
mcastaddr: 239.255.1.1
mcastport: 5405
ttl: 1
quorum
provider: corosync_votequorum
two_node: 1
nodelist
node
ring0_addr: 10.0.0.1
name: node01
nodeid: 1
node
ring0_addr: 10.0.0.2
name: node02
nodeid: 2
logging
to_logfile: yes
logfile: /var/log/corosync/corosync.log
to_syslog: yes
timestamp: on
Note that if you choose the proper bindnetaddr directive, you can use the exact same file for all the nodes (see corosync.conf(5))
System, daemons, servicesYou may want to check that the corosync and pacemaker services are auto-started at boot time by systemd.
Do a reboot and check it:
$
sudo
systemctl status corosync
grep
active
Active: active (running) since mi 2016-02-24 18:54:37 CET; 3min 11s ago
$
sudo
systemctl status pacemaker
grep
active
Active: active (running) since mi 2016-02-24 18:54:38 CET; 3min 10s ago
Also, check that no firewall blocks the communication between both nodes.
Now, the status of the cluster should show both nodes working together (with no resources):
$
sudo
crm status
Last updated: Wed Feb 24 19:01:13 2016 Last change: Wed Feb 24 18:43:32 2016 by hacluster via crmd on node01
Stack: corosync
Current DC: node02 (version 1.1.14-70404b0) - partition with quorum
2 nodes and 0 resources configured
Online: [ node01 node02 ]
Full list of resources:
ResourcesNow, you can start playing with the cluster resources. Below is an example of a virtual IPv6 address:
$
sudo
crm configure primitive test ocf:heartbeat:IPv6addr params ipv6addr=
"fe00::200"
cidr_netmask=
"64"
nic=
"eth0"
Which should give this cluster status:
$
sudo
crm status
Last updated: Wed Feb 24 19:13:46 2016 Last change: Wed Feb 24 19:11:45 2016 by root via cibadmin on node02
Stack: corosync
Current DC: node02 (version 1.1.14-70404b0) - partition with quorum
2 nodes and 1 resource configured
Online: [ node01 node02 ]
Full list of resources:
test (ocf::heartbeat:IPv6addr): Started node01
Congratulations, now you have a working HA cluster with a virtual IP address, using an active/backup approach.
Please, report any bug you may find.